package com.jxaummd.mushroom.main.user.item;

import android.view.View;
import android.widget.TextView;


import com.jxaummd.mushroom.R;
import com.jxaummd.mushroom.main.user.data.SingleTextListenerModel;

import java.util.List;

import eu.davidea.flexibleadapter.FlexibleAdapter;

import eu.davidea.flexibleadapter.items.AbstractFlexibleItem;
import eu.davidea.flexibleadapter.items.IFlexible;
import eu.davidea.viewholders.FlexibleViewHolder;

public class SignalTextItem extends AbstractFlexibleItem<SignalTextItem.ViewHolder> {
    private SingleTextListenerModel model = null;

    public SignalTextItem(SingleTextListenerModel model) {
        this.model = model;
    }

    @Override
    public boolean equals(Object o) {
        return o.equals(this);
    }

    @Override
    public int getLayoutRes() {
        return R.layout.user_item_single_text;
    }

    @Override
    public ViewHolder createViewHolder(View view, FlexibleAdapter<IFlexible> adapter) {
        return new ViewHolder(view,adapter);
    }

    @Override
    public void bindViewHolder(FlexibleAdapter<IFlexible> adapter, ViewHolder holder, int position, List<Object> payloads) {
        holder.mTitle.setText(model.getmTitle());
        holder.itemView.setOnClickListener(model.getListener());
    }


    class ViewHolder extends FlexibleViewHolder {
        TextView mTitle = null;

        public ViewHolder(View view, FlexibleAdapter adapter) {
            super(view, adapter);
            mTitle=itemView.findViewById(R.id.ec_tv_peron_setting_item_title);
        }
    }
}
